package com.ifdom.thread.basiccreatethread;

/**
 * @Author ifredomvip@gmail.com
 * @Date 2022/9/21 10:58
 * @Version 1.0.0
 * @Description
 **/
public class ExtendThread extends Thread {
    private final String threadName;

    public ExtendThread(String threadName) {
        this.threadName = threadName;
    }

    @Override
    public void run() {

        for (int i = 0; i < 5; i++) {
            System.out.println("线程名：" + Thread.currentThread().getName());
            try {
                sleep((int) (Math.random() * 10));
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

}